import { createRouter, createWebHistory } from 'vue-router'
import Home from '@/views/Home.vue'
import Layout from '@/components/Layout.vue'

const routes = [
  {
    path:'/',
    redirect:'/login'
  },
  {
    path: '/info',
    name: 'Info',
    component: () => import('@/views/Info.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/RegisterView.vue')
  },
  {
    path: '/home',
    name: 'Home',
    component: Layout,
    meta:{
      title:'登录后主页面'
    },
    children:[
      {
        //个人信息主页,修改头像等操作
        path: '/info',
        name: 'Info',
        component: () => import('@/views/Info.vue')
      },
      {
        path: '/dashboard',
        name: 'dashboard',
        meta:{title:'数据板', icon: 'House',top:true},
        component: () => import('../views/Dashboard.vue')
      },
      {
        path: '/user-management',
        name: 'UserManagement',
        meta: { title: '会员管理', icon: 'UserFilled',top: true},
        children: [
          {
            path: 'user',
            name: 'User',
            component: () => import('@/views/user-fold/User.vue'),
            meta: { title: '会员', icon: 'User' }
          },
          {
            path: 'user-card',
            name: 'UserCard',
            component: () => import('@/views/user-fold/UserCard.vue'),
            meta: { title: '会员卡', icon: 'CreditCard' }
          },
          {
            path: 'user-bind',
            name: 'UserBind',
            component: () => import('@/views/user-fold/UserBind.vue'),
            meta: { title: '会员绑定', icon: 'Connection' }
          }
        ]
      },
      // {
      //   path: '/menu-management',
      //   name: 'MenuManagement',
      //   component: () => import('@/views/MenuManagement.vue'),
      //   meta: { title: '菜单管理', icon: 'Menu',top:true }
      // },
    
      // {
      //   path: '/Log-management',
      //   name: 'LogManagement',
      //   component: () => import('@/views/LogManagement.vue'),
      //   meta: { title: '日志管理', icon: 'EditPen',top:true }
      // },
      {
        path: '/Teacher-management',
        name: 'TeacherManagement',
        component: () => import('@/views/TeacherManagement.vue'),
        meta: { title: '老师管理', icon: 'Avatar',top:true }
      },    
      {
        path: '/Course-management',
        name: 'Course-management',
        meta: { title: '团课管理', icon: 'Calendar',top:true },
        children:[
          {
            path: 'Course-list',
            name: 'Course-list',
            component: () => import('@/views/course-management/course-list.vue'),
            meta: { title: '团课课程', icon: 'Avatar' }
          },
          {
            path: 'Course-table',
            name: 'Course-table',
            component: () => import('@/views/course-management/course-table.vue'),
            meta: { title: '团课课程表', icon: 'Avatar' }
          },
          {
            path: 'Course-reservation',
            name: 'Course-reservation',
            component: () => import('@/views/course-management/course-reservation.vue'),
            meta: { title: '团课预约设置', icon: 'Avatar' }
          },
        ]
      },
      {
        path: '/Data-management',
        name: 'Data-management',
        meta: { title: '数据统计', icon: 'UserFilled',top:true },
        children:[
          {
            path: 'Membercard-statistics',
            name: 'Membercard-statistics',
            component: () => import('@/views/data-management/membercard-statistics.vue'),
            meta: { title: '会员卡统计', icon: 'Avatar' }
          },
          {
            path: 'Charge-statistics',
            name: 'Charge-statistics',
            component: () => import('@/views/data-management/charge-statistics.vue'),
            meta: { title: '收费统计', icon: 'Avatar' }
          },
          {
            path: 'Class-consumption-statistics',
            name: 'Class-consumption-statistics',
            component: () => import('@/views/data-management/class-consumption-statistics.vue'),
            meta: { title: '课时消费统计', icon: 'Avatar' }
          },
          {
            path: 'Class-total-statistics',
            name: 'Class-total-statistics',
            component: () => import('@/views/data-management/class-total-statistics.vue'),
            meta: { title: '总课次统计', icon: 'Avatar' }
          },
          {
            path: 'Add-loss-statistics',
            name: 'Add-loss-statistics',
            component: () => import('@/views/data-management/add-loss-statistics.vue'),
            meta: { title: '新增与流失统计', icon: 'Avatar' }
          },
        ]
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router